package com.bytime.uams.permissionmanage.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.bytime.uams.action.common.EossCommFunc;

public class Popdom001Form extends ActionForm
{
	private String addTitle;
	private String backFlag;
	private String caption;
	private String description;
	private String disableFlag;
	private String editTitle;
	private String[] menuCode;
	private String[] functionName;
	private String funListSelect;

	private String hidMenuCode= "";
	private String hidFunctionName= "";
	private String id;
	private String returnFlag;
	private String returnURI;
	private String roleName;
	private String roleNumber;
	private String saveFlag;
    private String treeReset;

	/**
	 * 
	 */
	/**
	 * 
	 */
	public Popdom001Form()
	{
		super();
	}

	/**
	 * @return
	 */
	public String getAddTitle()
	{
		return addTitle;
	}
	/**
	 * @return
	 */
	public String getBackFlag()
	{
		return backFlag;
	}

	public String getCaption()
	{
		return caption;
	}

	public String getDescription()
	{
		return description;
	}

	/**
	 * @return
	 */
	public String getDisableFlag()
	{
		return disableFlag;
	}

	/**
	 * @return
	 */
	public String getEditTitle()
	{
		return editTitle;
	}

	public String[] getMenuCode()
	{
		return menuCode;
	}

	public String[] getFunctionName()
	{
		return functionName;
	}

	public String getFunListSelect()
	{
		return funListSelect;
	}

	/**
	 * @return
	 */
	public String getHidMenuCode()
	{
		return hidMenuCode;
	}

	/**
	 * @return
	 */
	public String getHidFunctionName()
	{
		return hidFunctionName;
	}

	public String getId()
	{
		return id;
	}

	/**
	 * @return
	 */
	public String getReturnFlag()
	{
		return returnFlag;
	}

	/**
	 * @return
	 */
	public String getReturnURI()
	{
		return returnURI;
	}

	public String getRoleName()
	{
		return roleName;
	}

	public String getRoleNumber()
	{
		return roleNumber;
	}

	public String getSaveFlag()
	{
		return saveFlag;
	}

	public void reset(
		ActionMapping actionMapping,
		HttpServletRequest httpServletRequest)
	{
	}

	/**
	 * @param sring
	 */
	public void setAddTitle(String sring)
	{
		addTitle= sring;
	}

	/**
	 * @param string
	 */
	public void setBackFlag(String string)
	{
		backFlag= string;
	}

	public void setCaption(String caption)
	{
		this.caption= caption;
	}

	public void setDescription(String description)
	{
		this.description= description;
	}

	/**
	 * @param string
	 */
	public void setDisableFlag(String string)
	{
		disableFlag= string;
	}

	/**
	 * @param string
	 */
	public void setEditTitle(String string)
	{
		editTitle= string;
	}

	public void setMenuCode(String[] menuCode)
	{
		this.menuCode= menuCode;
	}

	public void setFunctionName(String[] functionName)
	{
		this.functionName= functionName;
	}

	public void setFunListSelect(String funListSelect)
	{
		this.funListSelect= funListSelect;
	}

	/**
	 * @param string
	 */
	public void setHidMenuCode(String string)
	{
		hidMenuCode= string;
	}

	/**
	 * @param string
	 */
	public void setHidFunctionName(String string)
	{
		hidFunctionName= string;
	}

	public void setId(String id)
	{
		this.id= id;
	}

	/**
	 * @param string
	 */
	public void setReturnFlag(String string)
	{
		returnFlag= string;
	}

	/**
	 * @param string
	 */
	public void setReturnURI(String string)
	{
		returnURI= string;
	}

	public void setRoleName(String roleName)
	{
		this.roleName= roleName;
	}

	public void setRoleNumber(String roleNumber)
	{
		this.roleNumber= roleNumber;
	}

	public void setSaveFlag(String saveFlag)
	{
		this.saveFlag= saveFlag;
	}

	public ActionErrors validate(
		ActionMapping actionMapping,
		HttpServletRequest httpServletRequest)
	{
		ActionErrors errors= new ActionErrors();

		String str= httpServletRequest.getParameter("method");
		if (str.equals("init"))
		{
			return null;
            
		}
		else if (str.equals("save"))
		{
			if (!EossCommFunc.isAlphaNumber(this.roleNumber))
			{
				errors.add(
					"roleNumber",
					new ActionError("error.popdom001.popdom1_1"));
			}
			if (!EossCommFunc.isMaxLength(this.roleNumber, 24))
			{
				errors.add(
					"roleNumber",
					new ActionError("error.popdom001.popdom1_2"));
			}
			if (!EossCommFunc.isMaxLength(this.roleName, 56))
			{
				errors.add(
					"roleName",
					new ActionError("error.popdom001.popdom1_3"));
			}
			if (!EossCommFunc.isMaxLength(this.description, 256))
			{
				errors.add(
					"description",
					new ActionError("error.popdom001.popdom1_4"));
			}
			return errors;
		}
		else
		{
			return null;
		}

		
	}

	
	/**
	 * @return
	 */
	public String getTreeReset()
	{
		return treeReset;
	}

	/**
	 * @param string
	 */
	public void setTreeReset(String string)
	{
		treeReset= string;
	}

}
